package vn.info.vietnaminfo.utli;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class ShareDefaultData
{
	public static String KEY_USER 		= "user";
	public static String KEY_DS_LOAI_HINH_KINH_DOANH 		= "danhsach";
	public static String KEY_PASS 		= "pass";
	public static String KEY_PARENTID 	= "parentId";
	
	public static SharedPreferences prefs = null;
	
	// Set user default data
	public static void setUserDefaultData(Context context, String key, String value)
	{
		prefs = PreferenceManager.getDefaultSharedPreferences(context);
		SharedPreferences.Editor editor = prefs.edit();
		editor.putString(key, value);
		editor.commit();
	}
		
	// Get user default data
	public static Object getUserDefaultData(Context context, String key)
	{
		prefs = PreferenceManager.getDefaultSharedPreferences(context);
		return prefs.getString(key, null);
	}
	
	//Return value string of key data
	public static String getValueKeyString(Context context, String key)
	{
		Object value = getUserDefaultData(context, key);			
		if (value != null)
		{
			return value.toString();
		}
		return null;
	}
	
}